/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.applicatioN.entities;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Slim
 */
@Entity
@Table(name = "exiger_2")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Exiger2.findAll", query = "SELECT e FROM Exiger2 e"),
    @NamedQuery(name = "Exiger2.findByNiveauExige", query = "SELECT e FROM Exiger2 e WHERE e.niveauExige = :niveauExige"),
    @NamedQuery(name = "Exiger2.findBySoftware", query = "SELECT e FROM Exiger2 e WHERE e.exiger2PK.software = :software"),
    @NamedQuery(name = "Exiger2.findByPoste", query = "SELECT e FROM Exiger2 e WHERE e.poste = :poste"),
    @NamedQuery(name = "Exiger2.findByNomPoste", query = "SELECT e FROM Exiger2 e WHERE e.exiger2PK.nomPoste = :nomPoste")})
public class Exiger2 implements Serializable {

    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected Exiger2PK exiger2PK;
    @Basic(optional = false)
    @Column(name = "NIVEAU_EXIGE")
    private int niveauExige;
    @JoinColumn(name = "SOFTWARE", referencedColumnName = "SOFTWARE", insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private Software software1;
    @JoinColumn(name = "NOM_POSTE", referencedColumnName = "NOM_POSTE", insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private Poste poste;

    public Exiger2() {
    }

    public Exiger2(Exiger2PK exiger2PK) {
        this.exiger2PK = exiger2PK;
    }

    public Exiger2(Exiger2PK exiger2PK, int niveauExige) {
        this.exiger2PK = exiger2PK;
        this.niveauExige = niveauExige;
    }

    public Exiger2(String software, String nomPoste) {
        this.exiger2PK = new Exiger2PK(software, nomPoste);
    }

    public Exiger2PK getExiger2PK() {
        return exiger2PK;
    }

    public void setExiger2PK(Exiger2PK exiger2PK) {
        this.exiger2PK = exiger2PK;
    }

    public int getNiveauExige() {
        return niveauExige;
    }

    public void setNiveauExige(int niveauExige) {
        this.niveauExige = niveauExige;
    }

    public Software getSoftware1() {
        return software1;
    }

    public void setSoftware1(Software software1) {
        this.software1 = software1;
    }

    public Poste getPoste() {
        return poste;
    }

    public void setPoste(Poste poste) {
        this.poste = poste;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (exiger2PK != null ? exiger2PK.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Exiger2)) {
            return false;
        }
        Exiger2 other = (Exiger2) object;
        if ((this.exiger2PK == null && other.exiger2PK != null) || (this.exiger2PK != null && !this.exiger2PK.equals(other.exiger2PK))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.applicatioN.entities.Exiger2[ exiger2PK=" + exiger2PK + " ]";
    }
}
